package com.webinsky.web.data;

public class Response<DATA> {
	/**
	 *  ok status
	 */
	public static final int STATUS_OK = 200;
	/**
	 *  internal error
	 */
	public static final int STATUS_INTERNAL_ERROR = 501;
	public static final int STATUS_NOTFOUND_ERROR = 401;
	public static final int STATUS_WRONGARUGS_ERROR = 405;
	
	
	private int status;
	private DATA data;
	private String message;
	
	public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
	public DATA getData() {
		return data;
	}
	public void setData(DATA data) {
		this.data = data;
	}
	
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	
	private Response(DATA data, int status, String message){
		this.data = data;
		this.status = status;
		this.message = message;
	}
	
	/**
	 * 生成response
	 * @param data
	 * @param status
	 * @param message
	 * @return
	 */
	public static <DATA> Response<DATA> create(DATA data, int status, String message){
		return new Response<DATA>(data, status, message);
	}

}
